const mongoose = require('mongoose');
const { ObjectId } = mongoose.Schema;

/**
 * Export model definition object.
 */
module.exports = {
  creatorId: ObjectId,
  projectId: ObjectId,
  versionId: ObjectId,
  fileName: String,
  path: String,
  extname: String,
  directoryId: { type: ObjectId, index: true },
  status: { type: Number, default: 0 },
  kind: { type: Number, min: 1, max: 2 },
  extra: Number,
  repository: {
    type: { type: Number, min: 1, max: 3 },
    url: String,
    branch: String,
    username: String,
  },
  failedCount: { type: Object, default: {} },
  succeedCount: { type: Object, default: {} },
  statementCovered: { type: Object, default: {} },
  statementTotal: { type: Object, default: {} },
  branchCovered: { type: Object, default: {} },
  branchTotal: { type: Object, default: {} },
  mcdcCovered: { type: Object, default: {} },
  mcdcTotal: { type: Object, default: {} },
  conditionCovered: { type: Object, default: {} },
  conditionTotal: { type: Object, default: {} },
  decisionCovered: { type: Object, default: {} },
  decisionTotal: { type: Object, default: {} },
  fileCount: { type: Object, default: {} },
  invokedFuncTotal: { type: Object, default: {} },
  invokedFuncCovered: { type: Object, default: {} },
  invokeTotal: { type: Object, default: {} },
  invokeCovered: { type: Object, default: {} },
  shieldFilesCount: { type: Object, default: {} },
  compiledCount: { type: Object, default: {} },
  compileFailedCount: { type: Object, default: {} },
  unreadCount: { type: Object, default: {} },
  waiting4compilingCount: { type: Object, default: {} },
  parsingTaskId: String,
  analyzeTaskId: String,
  includeFiles: { type: Object, default: {} },
  numberOfLines: { type: Number, default: 0 }, // 文件总行数
  sourceLines: { type: Number, default: 0 }, // 有效代码行数
  commentLines: { type: Number, default: 0 }, // 注释行数
  emptyLines: { type: Number, default: 0 }, // 空白行数
  defectsCount: { type: Object, default: {} },
  encoding: String,
  collectCoverage: Boolean,
};
